package team.star.werespos.model.enums;

import lombok.Getter;
import lombok.ToString;

/**
 * CodeMsgEnum enum<br/>
 * 与客户端交互的状态码信息类
 *
 * @author hdonghong
 * @since 2018/08/10
 */
@Getter
@ToString
public enum CodeMsgEnum {

    /** 通用模块状态码  */
    SUCCESS(200, "success"),
    SERVER_ERROR(500100, "服务端异常错误"),
    CLIENT_ERROR(500101, "客户端请求错误"),
    PARAMETER_ERROR(500102, "客户端请求参数校验错误"),
    DATABASE_EXCEPTION(500103, "服务端数据库操作异常"),
    INVALID_OPERATION(500104, "不合理操作！！！"),
    PARAMETER_NULL(500105, "空指针问题！"),

    /** 授权登录模块 */
    LOG_IN(500201, "未登录"),
    UNAUTHORIZED(500202, "无权限"),

    /** 用户模块 5003XX */
    USER_NOT_EXIST(500301, "用户不存在"),
    USER_AUTHORIZE_FAIL(500302, "账号不存在或密码错误"),
    USER_ACCOUNT_ERROR(500303, "账户异常"),
    USER_INVALID_DELETE(500304, "用户无法删除自己"),
    PASSWORD_ERROR(500305, "用户密码错误"),

    /** 角色模块 5004XX */
    ROLE_NOT_EXIST(500401, "角色不存在"),

    /** 商品模块 */
    FOOD_NOT_EXIST(500601, "id错误，菜品不存在"),

    /** 订单模块 */
    ORDER_NOT_EXIST(500701, "订单不存在"),
    ORDER_EMPTY(500702, "空订单"),
    ORDER_STATUS_EXCEPTION(500703, "订单状态异常"),

    /** 餐桌模块 */
    TABLE_NOT_EXIST(500801, "餐桌不存在"),
    TABLE_NUM_REPEAT(500802, "重复的桌号"),
    TABLE_UNAVAILABLE(500803, "该餐桌暂不可用"),
    TABLE_NO_ORDER(500804, "该餐桌当前没有订单"),
    ;

    private int code;
    private String msg;

    CodeMsgEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
